package com.zzg.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zzg.redis.util.RedisUtil;

@Controller
@RequestMapping("/api/redis")
public class RedisController {
	@Autowired
	private RedisUtil redisUtil;
	
	@RequestMapping(value="/set", method={RequestMethod.GET})
	public void set(@RequestParam String key, @RequestParam String value) {
		redisUtil.set(key, value);
		System.out.println("redis set success");
	}
	
	@RequestMapping(value="/get", method={RequestMethod.GET})
	@ResponseBody
	public String get(@RequestParam String key) {
		return redisUtil.get(key);
	}

}
